package com.yidiandao.business.ui.main.shoppingcart.chooseinvoice;

import android.app.Activity;
import android.content.Intent;

import com.yidiandao.business.R;
import com.yidiandao.business.base.BaseActivity;
import com.yidiandao.business.data.model.InvoiceModel;
import com.yidiandao.business.utils.ActivityUtils;

/**
 * 发票 Activity.
 */
public class ChooseInvoiceActivity extends BaseActivity {

    private ChooseInvoiceFragment mChooseInvoiceFragment;

    public static void actionStart(Activity activity) {
        Intent intent = new Intent(activity, ChooseInvoiceActivity.class);
        activity.startActivity(intent);
    }

    @Override
    protected void initFragment() {
        mChooseInvoiceFragment = (ChooseInvoiceFragment)
                getSupportFragmentManager().findFragmentById(R.id.container_invoice);

        if (mChooseInvoiceFragment == null) {
            mChooseInvoiceFragment = ChooseInvoiceFragment.getInstance(getIntent().getExtras());
            ActivityUtils.addFragmentToActivity(   getSupportFragmentManager(), mChooseInvoiceFragment, R.id.container_invoice);
        }
    }

    @Override
    protected void initPresenter() {
        new ChooseInvoicePresenter(mChooseInvoiceFragment, new InvoiceModel());
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_choose_invoice;
    }
}
